

<%@ page import="poradnia.Pacjent" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'pacjent.label', default: 'Pacjent')}" />
        <title><g:message code="default.edit.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="default.edit.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${pacjentInstance}">
            <div class="errors">
                <g:renderErrors bean="${pacjentInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${pacjentInstance?.id}" />
                <g:hiddenField name="version" value="${pacjentInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="nazwisko"><g:message code="pacjent.nazwisko.label" default="Nazwisko" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: pacjentInstance, field: 'nazwisko', 'errors')}">
                                    <g:textField name="nazwisko" maxlength="100" value="${pacjentInstance?.nazwisko}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="imie"><g:message code="pacjent.imie.label" default="Imie" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: pacjentInstance, field: 'imie', 'errors')}">
                                    <g:textField name="imie" maxlength="100" value="${pacjentInstance?.imie}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="pesel"><g:message code="pacjent.pesel.label" default="Pesel" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: pacjentInstance, field: 'pesel', 'errors')}">
                                    <g:textField name="pesel" maxlength="11" value="${pacjentInstance?.pesel}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="adres"><g:message code="pacjent.adres.label" default="Adres" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: pacjentInstance, field: 'adres', 'errors')}">
                                    <g:textArea name="adres" cols="40" rows="5" value="${pacjentInstance?.adres}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="dataUrodzenia"><g:message code="pacjent.dataUrodzenia.label" default="Data Urodzenia" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: pacjentInstance, field: 'dataUrodzenia', 'errors')}">
                                    <g:datePicker name="dataUrodzenia" precision="day" value="${pacjentInstance?.dataUrodzenia}"  />
                                    <!--calendar:datePicker name="dataUrodzenia" value="${pacjentInstance?.dataUrodzenia}"  /-->
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="telefon"><g:message code="pacjent.telefon.label" default="Telefon" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: pacjentInstance, field: 'telefon', 'errors')}">
                                    <g:textField name="telefon" value="${pacjentInstance?.telefon}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="wizyta"><g:message code="pacjent.wizyta.label" default="Wizyta" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: pacjentInstance, field: 'wizyta', 'errors')}">
                                    
<ul>
<g:each in="${pacjentInstance?.wizyta?}" var="w">
    <li><g:link controller="wizyta" action="show" id="${w.id}">${w?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="wizyta" action="create" params="['pacjent.id': pacjentInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'wizyta.label', default: 'Wizyta')])}</g:link>

                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
